<template>
  <j-modal :title="title" :width="width" :visible="visible" switchFullscreen :footer="null" @cancel="handleCancel">
    <ene-fault-repair-check-form
      ref="realForm"
      @ok="submitCallback"
      :disabled="disableSubmit"
    ></ene-fault-repair-check-form>
    <div v-if="!disableSubmit" style="display: flex;justify-content: end;margin:10px 0px;">
      <a-button @click="handleCancel" style="margin-right:5px;">取消</a-button>
      <a-button @click="check0" style="margin-right:5px;">审核拒绝</a-button>
      <a-button type="primary" @click="check1">审核通过</a-button>
    </div>
  </j-modal>
</template>

<script>
import EneFaultRepairCheckForm from './EneFaultRepairCheckForm'
export default {
  name: 'EneFaultRepairCheckModal',
  components: {
    EneFaultRepairCheckForm
  },
  data() {
    return {
      title: '',
      width: 800,
      visible: false,
      disableSubmit: false
    }
  },
  methods: {
    check(record) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.realForm.check(record)
      })
    },
    detailinfo(record) {
      this.visible = true
      this.disableSubmit = true;
      this.$nextTick(() => {
        this.$refs.realForm.detailinfo(record)
      })
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    check1() {
      this.$refs.realForm.submitForm(1)
    },
    check0() {
      this.$refs.realForm.submitForm(0)
    },
    submitCallback() {
      this.$emit('ok')
      this.visible = false
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>
